
package com.hlkj.pay.vo.openapi.order.req;
/*
 * Hlpay-Plus aggregate payment system.
 * Copyright (c) 2024-2025 Hlpay Team Copyright has the right of final interpretation.
 */

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import com.hlkj.framework.common.util.json.JsonUtils;
import com.hlkj.framework.common.valid.HttpHttpsURL;
import com.hlkj.framework.common.valid.ValidAmount;
import com.hlkj.pay.vo.BaseReq;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

/**
 * @author HlpayTeam
 * @date 2024/10/09 11:37
 */
@Data
public class PaymentCommonParamReq extends BaseReq {

    @Schema(description = "通道编码")
    @NotEmpty(message = "通道编码 不能为空")
    private String mchChannelCode;

    @Schema(description = "支付方式 1- 支付宝账户； 2- 微信零钱；3-银行卡 4-渠道内部户")
    @NotNull(message = "方式 不能为空")
    private Integer entryType;

    @Schema(description = "商户订单号 规则 英文字符,数字,_")
    @NotEmpty(message = "商户订单号 不能为空")
    @Size(max = 32)
    private String mchOrderNo;

    @Schema(description = "转账金额 单位元")
    @NotEmpty(message = "转账金额 不能为空")
    @ValidAmount(message = "转账金额 无效")
    private String amount;

    @Schema(description = "买家ip")
    @NotEmpty(message = "买家ip 不能为空")
    private String clientIp;

    @Schema(description = "转账说明")
    private String remark;

    @Schema(description = "收款方姓名")
    @NotEmpty(message = "收款方姓名 不能为空")
    private String name;

    @Schema(description = "收款人账号，支付宝为支付宝账号，微信为openid，银行卡为银行卡账号，渠道内部户为内部账号")
    @NotEmpty(message = "收款人账号 不能为空")
    private String cardNo;

    @Schema(description = "特殊支付通道额外参数")
    private Extra extra;

    @Schema(description = "支付结果异步通知地址")
    @HttpHttpsURL
    private String notifyUrl;

    @Schema(description = "收款方类型，1=个人，2=企业，入账方式为3或4必传，其它非必传")
    private Integer payeeType;

    @Schema(description = "收款方银行编码，入账方式为3必传，其它非必传")
    private String bankCode;

    @Schema(description = "收款方银行名称，入账方式为3必传，其它非必传")
    private String bankName;

    @Schema(description = "联行号，入账方式为3必传，其它非必传")
    private String branchCode;

    @Data
    public static class Extra {

        @Schema(description = "账号类型 1:通道会员ID 2:通道登录号 3:通道openid 当入账方式为1必填")
        private Integer accountType = 2;

        @Schema(description = "是否使用付款方别名作为收款方在支付宝账单中")
        private boolean payerShowName = true;

    }

    public static void main(String[] args) {
        PaymentCommonParamReq paymentCommonParamReq = new PaymentCommonParamReq();
        paymentCommonParamReq.setMchChannelCode("1868908387423174656");
        paymentCommonParamReq.setEntryType(1);
        paymentCommonParamReq.setMchOrderNo("1868908387423174656");
        paymentCommonParamReq.setAmount("0.01");
        paymentCommonParamReq.setClientIp("127.0.0.1");
        paymentCommonParamReq.setRemark("test");
        paymentCommonParamReq.setName("周龙");
        paymentCommonParamReq.setCardNo("18327318860");
        PaymentCommonParamReq.Extra extra1 = new PaymentCommonParamReq.Extra();
        extra1.setAccountType(2);
        paymentCommonParamReq.setExtra(extra1);
        paymentCommonParamReq.setNotifyUrl("");
        paymentCommonParamReq.setPayeeType(1);
        paymentCommonParamReq.setBankCode("");
        paymentCommonParamReq.setBankName("");
        paymentCommonParamReq.setBranchCode("");
        System.out.println(JsonUtils.toJsonString(paymentCommonParamReq).toString());
    }

}
